package com.lihua.project.taskcenter.taskcenter.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author lihua
 * @date 2022/3/18 18:16
 * 任务组，用户存放两个任务
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TaskGroup implements Comparable {
    /**任务*/
    private Task task;
    /**关联的任务*/
    private Task taskLink;
    /**两个任务的匹配度（相似度）*/
    private int score;

    @Override
    public int compareTo(Object o) {
        if (o instanceof TaskGroup){
            TaskGroup taskGroup = (TaskGroup) o;
            return -Integer.compare(this.score,taskGroup.score);
        }
        throw new ClassCastException("类型转换异常");
    }
}
